package com.yiyahui.project.erp.service.impl;

import java.util.List;
import com.yiyahui.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yiyahui.project.erp.mapper.YiyaAuditDiscountMapper;
import com.yiyahui.project.erp.domain.YiyaAuditDiscount;
import com.yiyahui.project.erp.service.IYiyaAuditDiscountService;

/**
 * 折扣审核Service业务层处理
 * 
 * @author yiyahui
 * @date 2020-06-09
 */
@Service
public class YiyaAuditDiscountServiceImpl implements IYiyaAuditDiscountService 
{
    @Autowired
    private YiyaAuditDiscountMapper yiyaAuditDiscountMapper;

    /**
     * 查询折扣审核
     * 
     * @param id 折扣审核ID
     * @return 折扣审核
     */
    @Override
    public YiyaAuditDiscount selectYiyaAuditDiscountById(Long id)
    {
        return yiyaAuditDiscountMapper.selectYiyaAuditDiscountById(id);
    }

    /**
     * 查询折扣审核列表
     * 
     * @param yiyaAuditDiscount 折扣审核
     * @return 折扣审核
     */
    @Override
    public List<YiyaAuditDiscount> selectYiyaAuditDiscountList(YiyaAuditDiscount yiyaAuditDiscount)
    {
        return yiyaAuditDiscountMapper.selectYiyaAuditDiscountList(yiyaAuditDiscount);
    }

    /**
     * 新增折扣审核
     * 
     * @param yiyaAuditDiscount 折扣审核
     * @return 结果
     */
    @Override
    public int insertYiyaAuditDiscount(YiyaAuditDiscount yiyaAuditDiscount)
    {
        yiyaAuditDiscount.setCreateTime(DateUtils.getNowDate());
        return yiyaAuditDiscountMapper.insertYiyaAuditDiscount(yiyaAuditDiscount);
    }

    /**
     * 修改折扣审核
     * 
     * @param yiyaAuditDiscount 折扣审核
     * @return 结果
     */
    @Override
    public int updateYiyaAuditDiscount(YiyaAuditDiscount yiyaAuditDiscount)
    {
        yiyaAuditDiscount.setUpdateTime(DateUtils.getNowDate());
        return yiyaAuditDiscountMapper.updateYiyaAuditDiscount(yiyaAuditDiscount);
    }

    /**
     * 批量删除折扣审核
     * 
     * @param ids 需要删除的折扣审核ID
     * @return 结果
     */
    @Override
    public int deleteYiyaAuditDiscountByIds(Long[] ids)
    {
        return yiyaAuditDiscountMapper.deleteYiyaAuditDiscountByIds(ids);
    }

    /**
     * 删除折扣审核信息
     * 
     * @param id 折扣审核ID
     * @return 结果
     */
    @Override
    public int deleteYiyaAuditDiscountById(Long id)
    {
        return yiyaAuditDiscountMapper.deleteYiyaAuditDiscountById(id);
    }

    @Override
    public void deleteByBillingMainId(Long billingMain) {
        yiyaAuditDiscountMapper.deleteByBillingMainId(billingMain);
    }
}
